home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / help / 5_programming / while < prev    next >
Encoding:
Text File  |  2002-10-28  |  1.2 KB  |  38 lines

  1. Synopsis:
  2.    while (<condition>) <action>
  3.    while (<condition>) [{ <action> }]
  4.  
  5. Description:
  6.    The WHILE loop is a sort of hybrid between the FOR loop and the IF
  7.    control statement.  It allows for repetitive action, as with FOR,
  8.    but the loop iterates (performs the action) only if a specific
  9.    condition is met, as with IF.
  10.  
  11.    The "condition" portion may contain any comparison or assignment
  12.    allowed in an IF statement.
  13.  
  14. Examples:
  15.    To display a warning message 3 times:
  16.       @ xx = 3
  17.       while ( xx > 0 ) {
  18.          echo WARNING!  This ship will self destruct in $xx seconds!
  19.          @ xx--
  20.       }
  21.  
  22.    A infinite loop that behaves like the Unix 'yes' command:
  23.       while ( 1 ) echo yes
  24.  
  25. Aliases:
  26.    UNTIL is the exact opposite of WHILE.  It is essentially the same
  27.    applying the negation operator (!) to the entire WHILE condition.
  28.  
  29. See Also:
  30.    fe(5); fec(5); for(5); foreach(5)
  31.  
  32. Other Notes:
  33.    WHILE has all of the capabilities of FOR, only in a different syntax.
  34.    The distinction between the two is not great enough to warrant a
  35.    recommendation of one over the other.  If anything, FOR tends to be
  36.    more concise than WHILE; however, this is not always the case.
  37.  
  38.